﻿<?php
require_once("mail.class.php");
$mailer = new SendMailClass();
?>
<?php
	$mailer->catchNeeded();
	$text = mysql_real_escape_string(trim(@$_POST['text']));
	$subject = mysql_real_escape_string(trim(@$_POST['subject']));
	$email = mysql_real_escape_string(trim(@$_POST['email']));
	$firstname = mysql_real_escape_string(trim(@$_POST['firstname']));
	$string = mysql_real_escape_string(trim(@$_POST['string']));
	$phone = mysql_real_escape_string(trim(@$_POST['phone']));
?>
        <div class="contactUs">
        <form action="" method="post">
            <ul>
                <li><label for="firstname">F&#246;rnamn:</label></li>
                <li><input type="text" name="firstname" id="firstname" value="<?php $firstname?>" /></li>
                <li><label for="subject">&#196;rende:</label></li>
                <li><input type="text" name="subject" id="subject" value="<?php $subject?>"/></li>
                <li><label for="email">Email</label></li>
                <li><input type="text" name="email" id="email" value="<?php $email?>"/></li>
                <li><label for="phone">Telefon:</label></li>
                <li><input type="text" name="phone" value="<?php $phone?>" /></li>
                <li><label for="text">Text</label></li>
                <li><textarea id="text" name="string"><?php $string?></textarea></li>
                <li><input id="submit" type="submit" name="submit" value="Skicka" /></li>
            </ul>
        </form>
        <?php
		if(isset($_POST['submit'])) {
			if(empty($firstname) || empty($subject) || empty($email) || empty($phone) || empty($string)) {
				if($firstname == "") {
					echo "<span class='error'>Fyll i ett f&#246;rnamn</span><br />";
				}
				if($subject == "") {
					echo "<span class='error'>Fyll i ett &#228;rende</span><br />";
				}
				if($email == "") {
					echo "<span class='error'>Fyll i en e-post adress</span><br />";
				}
				if($phone == "") {
					echo "<span class='error'>Fyll i ett nummer</span><br />";
				}
				if($text == "") {
					echo "<span class='error'>Fyll i textf&#228;ltet</span><br />";
				}
			}
			else {
				echo "Meddelande skickat";
				$text = "
				Nytt meddelande från STAR GayDisco.<br />
				namn: ".$firstname."<br />
				email: ".$email."<br />
				phone: ".$phone."<br />
				meddelande: <br /> ".$string."
				";
				$mailer->htmlMail('info@ziinloader.com', $text, $subject, $email, $firstname);
			}
		}
		?>